import { Game06_Group, Game06_Suits } from './Game06_Data';
import QuickTool from '../base/Tool/QuickTool';
// Learn TypeScript:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class Game06_Card extends cc.Component {

    @property(cc.Node)
    bgNode: cc.Node = null;

    @property(cc.Label)
    pointLabel: cc.Label = null;

    @property(cc.Node)
    smallFlowerNode: cc.Node = null;

    @property(cc.Node)
    bigNode: cc.Node = null;

    @property(cc.Node)
    smallFlowerNode_mb: cc.Node = null;

    @property(cc.Node)
    bigNode_mb: cc.Node = null;

    @property(cc.Node)
    okNode: cc.Node = null;

    @property(cc.Node)
    cellNode: cc.Node = null;

    ok = false;
    use = false;

    _g = null;
    _p = null;
    _f = null;

    onLoad () {
        this.cellNode.active = false
    }

    start () {
        
    }

    set (g: Game06_Group, pColor: any, frames) {
        this._g = g
        this._p = pColor
        this._f = frames

        let point = g.point
        let suits = g.suits
        if (point == null) {
            point = Game06_Suits.allPoints[QuickTool.randomNum(0, Game06_Suits.allPoints.length-1)]
        }

        if (suits == -1) {
            suits = Game06_Suits.allSuits[QuickTool.randomNum(0, Game06_Suits.allSuits.length-1)]
        }

        this.cellNode.active = true

        this.pointLabel.string = point
        this.smallFlowerNode.getComponent(cc.Sprite).spriteFrame = frames[suits]
        this.smallFlowerNode_mb.getComponent(cc.Sprite).spriteFrame = frames[suits]
        this.bigNode.getComponent(cc.Sprite).spriteFrame = frames[suits]
        this.bigNode_mb.getComponent(cc.Sprite).spriteFrame = frames[suits]

        this.smallFlowerNode.color = pColor.color
        this.bigNode.color = pColor.color
        this.pointLabel.node.color = pColor.color

        this.bgNode.color = g.color.color
    }

    reset () {
        this.cellNode.active = false
        this.okNode.active = false
        this.use = false
        this.ok = false
    }

    doUse () {
        this.cellNode.active = false
        this.okNode.active = true
        this.use = true
    }
}

/**
 * public void NOSomethingA()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingB()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingC()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingD()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingE()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingF()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingG()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingH()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingI()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingJ()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingK()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingL()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingM()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingN()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingO()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingP()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingQ()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingR()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingS()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingT()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingU()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
public void NOSomethingV()
{
    string name = "NoName";
    string first = "what monther's is who?011245";
}
 */
